<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-bind指令</title>
    <style>
        .active {
            border: 1px solid red;
        }
    </style>
</head>
<body>
<div id="app">
    <h2>微信公众号</h2>
    <img v-bind:src="imgSrc" alt="">
    <br>
    <img :src="imgSrc" :title="imgtitle+'!!'"
         :class="isActive?'active':''" @click="toggleActive">
    <br>
    <img :src="imgSrc" :title="imgtitle+'!!'"
         :class="{active:isActive}" @click="toggleActive">
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    var vue = new Vue({
        el: "#app",
        data: {
            imgSrc: "https://gitee.com/joeljhou/Mapdepot/raw/master/image/20200916181021.jpg",
            imgtitle: "itzhouyu的微信公众号",
            isActive: false
        },
        methods: {
            toggleActive: function () {
                this.isActive = !this.isActive
            }
        }
    })
</script>
</body>
</html>
